//
//  HandInViewController.m
//  OrderFood
//
//  Created by xiaofang wang on 2018/10/24.
//  Copyright © 2018年 zhiyuan. All rights reserved.
//

#import "HandInViewController.h"
#import "StoreOrderViewController.h"
#import "ListSelectView.h"
#import "StoreCell.h"
@interface HandInViewController ()<UITableViewDelegate,UITableViewDataSource>
@property(nonatomic,strong)UITableView *billTableView;

@end

@implementation HandInViewController
-(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    self.navigationController.navigationBarHidden = NO;
    
}
- (void)viewDidLoad {
    [super viewDidLoad];
    self.name = @"外卖现金上交";
    
    // 初始化UI
    [self setupUI];
    
}
// 初始化UI
- (void)setupUI{
    [self loadTableViewWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT-SafeAreaTopHeight) tableViewStyle:UITableViewStyleGrouped refreshStyle:LSRefreshTypeJustHeader];
    self.mytableview.delegate = self;
    self.mytableview.dataSource = self;
    [self ls_headerBeginRefreshing];
}
- (void)requestNewData{
    [self ls_headerEndRefreshing];
}
- (void)requestMoreData{
    [self ls_footerEndRefreshing];
}



#pragma mark - Table view data source

-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 10;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 1;
}

- (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    static NSString *cellID = @"StoreCellId";
    StoreCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
    if (cell == nil) {
        cell = [[StoreCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
    }
    
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    [cell.actionBtn addTarget:self action:@selector(handin:) forControlEvents:UIControlEventTouchUpInside];
    return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    
    StoreOrderViewController *vc = [[StoreOrderViewController alloc] init];
    [self.navigationController pushViewController:vc animated:YES];
}
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
    return 10;
}
-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
    return 0.0001;
}

-(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
    return nil;
}
-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
    return nil;
}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 182;
}

-(void)handin:(UIButton *)sender{

    ListSelectView *listView = [[ListSelectView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT) title:NSLocalizedString(@"sjmdTitle", nil) dataAry:@[@"西湖银泰店",@"下沙银泰店",@"西湖银泰店",@"下沙银泰店",@"西湖银泰店",@"下沙银泰店",@"西湖银泰店",@"下沙银泰店"]];
    [self.navigationController.view addSubview:listView];
    
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
